#pragma once

#include <fstream>
#include "LogLevelEnum.h"

namespace glimmer{
    class Logger {
    public:
        /// @brief 日志系统初始化
        /// @param dir: 输出目录
        /// @param filename: 文件名
        static void InitLogger(const char* dirPath, const char* filename);

        static void Info(const char* message, ...);
        static void Warning(const char* message, ...);
        static void Error(const char* message, ...);

        static void InfoScript(const char* message, ...);
        static void WarningScript(const char* message, ...);
        static void ErrorScript(const char* message, ...);

    private:

        static void Log(LogLevelEnum level, const char* tag, const char* message);
        static void OutputToConsole(LogLevelEnum level, const char* message);
		static void OutputToFile(const char* message);
        static void AutoClearLogFileOldest();

        static bool console_enabled;
        static bool file_enabled;

        // auto clear
        static size_t autoClearThreshold;
        static size_t logFileCount;
    };
}